package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202409;

import java.util.Stack;

public class leetcode20240914 {
    public String removeStars(String s) {
        StringBuffer sb=new StringBuffer();
        Stack<Character> stack=new Stack<>();
        for(char ch : s.toCharArray()){
            if(ch=='*'){
                stack.pop();
            }else{
                stack.push(ch);
            }
        }
        while(!stack.isEmpty()){
            sb.append(stack.pop());
        }
        return sb.reverse().toString();
    }
}
